﻿// Write an expression that checks for given point (x, y) if it is within the circle K((1,1), 3) 
// and out of the rectangle R(top=1, left=-1, width=6, height=2).

using System;

class CheckPointWithinCircleOutRectangle
{
    static void Main()
    {
        Console.Write("Enter x coordinate of the point: ");
        double x = double.Parse(Console.ReadLine());
        Console.Write("Enter y coordinate of the point: ");
        double y = double.Parse(Console.ReadLine());

        double xCoordinates = Math.Pow((1 - x), 2);
        double yCoordinates = Math.Pow((1 - y), 2);
        bool withinCircle = false;
        if (xCoordinates + yCoordinates <= 9)
        {
            withinCircle = true;
        }

        bool withinCircleOutRectangle = false;
        bool outRectX = false;
        if ((x >= -1) && (x <= 5))
        {
            if ((y < -1) || (y > 1))
            {
                outRectX = true;
            }
        }
        else
        {
            outRectX = true;
        }

        bool outRectY = false;
        if ((y >= -1) && (y <= 1))
        {
            if ((x < -1) || (x > 5))
            {
                outRectY = true;
            }
        }
        else
        {
            outRectY = true;
        }

        if (withinCircle && outRectX && outRectY) 
        {
            withinCircleOutRectangle = true;
        }

        Console.WriteLine("Your point is within the circle and out of the rectangle: {0}", withinCircleOutRectangle);
    }
}
